<template>
	<view class="content p60 ">
		<view class="dis_cc mb80">
			<image src="../static/logo.png" mode="widthFix" class="logo "></image>
		</view>
		<uni-forms ref="baseForm"  :modelValue='baseFormData' :rules='rules'>
			<!-- <view class='bb1'> -->
				<uni-forms-item  name="ex_mobile" class='bb1 line22' >
				<uni-easyinput prefixIcon='person'  v-model="baseFormData.ex_mobile"  placeholder="请输入登录账号" :inputBorder="false" />
				</uni-forms-item>
			<!-- </view> -->
			<view class="bb1 pt10"></view>
			<!-- <view class='bb1 mt20'> -->
				<uni-forms-item  name="ex_pwd" class='bb1 mt20 line22'>
					<uni-easyinput prefixIcon="locked" type="password"  v-model="baseFormData.ex_pwd" class='bb1' placeholder="请输入密码" :inputBorder="false" />
				</uni-forms-item>
			
			<!-- </view> -->
		</uni-forms>	
		<button class="pl60 pr60 bbg mt60" @click='go'>登录</button>
	</view>
</template>

<script>
	import {businessLogin} from '@/utils/api'
	export default {
		data() {
			return {
				baseFormData:{
					ex_mobile:"",
					ex_pwd:''
				},
				rules:{
					ex_mobile: {
						rules: [
							{ required: true, errorMessage: '请输入手机号',}
						]
					},
					ex_mobile:{
						rules: [
							{ required: true, errorMessage: '请输入密码' }
						]
					}
				}
			}
		},
		onLoad() {

		},
		methods: {
			go(){
				this.$refs.baseForm.validate().then(res => {
					// console.log(data)
					// return;
					businessLogin(this.baseFormData).then(res=>{
						let data=res.data
						uni.setStorageSync('token',data.access_token)
						uni.reLaunch({
							url:'/pages/index/index'
						})
					})
				}).catch(err => {
					console.log(err,'验证失败')
				})
			}
		}
	}
</script>

<style>
	.content {padding-top: 15%;}
	.logo {width: 200rpx; }
</style>
